﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace shavp.core
{
    public interface ISHCommand
    {
        OperationResult CanExecute(object o);
        OperationResult Execute(object o);
    }

    public enum OperationResultEnum
    {
        Successfull,
        Failed
    }

    public class OperationResult
    {
        public OperationResultEnum Result { get; private set; }
        public ReadOnlyCollection<string> Messages { get; private set; }

        public static OperationResult Successfull()
        {
            return Successfull(new List<string>());
        }

        public static OperationResult Successfull(IList<string> messages)
        {
            return new OperationResult
                {
                    Result = OperationResultEnum.Successfull,
                    Messages = new ReadOnlyCollection<string>(messages)
                };
        }

        public static OperationResult Failed()
        {
            return Failed(new List<string>());
        }

        public static OperationResult Failed(IList<string> messages)
        {
            return new OperationResult
                {
                    Result = OperationResultEnum.Failed,
                    Messages = new ReadOnlyCollection<string>(messages)
                };
        }
    }
}
